home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
public
/
RTF
/
rtftoken.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-01
|
5KB
|
411 lines
/* rtftoken.h
from:
rtf.h - RTF document processing stuff. Distribution 1.06.
*/
#ifndef __rtftoken_h
#define __rtftoken_h
#define EOF (-1)
class RTF{
public:
/*
Twentieths of a point (twips) per inch (Many RTF measurements
are in twips per inch (tpi) units). Assumes 72 points/inch.
*/
enum{ twips= 1440};
/*
Token classes (must be zero-based and sequential)
*/
enum{
Unknown,
Group,
Text,
Control,
Eof,
MaxClass};
/*
Brace class major numbers
*/
enum{
BeginGroup,
EndGroup};
/*
Control class major and minor numbers.
*/
enum{
Version,
DefFont,
CharSet,
Destination,
FontFamily,
ColorName,
SpecialChar,
StyleAttr,
DocAttr,
SectAttr,
TblAttr,
ParAttr,
CharAttr,
PictAttr,
FieldAttr,
TOCAttr,
PosAttr};
enum{
Pict,
Footnote,
Header,
HeaderLeft,
HeaderRight,
HeaderFirst,
Footer,
FooterLeft,
FooterRight,
FooterFirst,
FNSep,
FNContSep,
FNContNotice,
Info,
StyleSheet,
FontTbl,
ColorTbl,
Field,
FieldInst,
FieldResult,
Index,
IndexBold,
IndexItalic,
IndexText,
IndexRange,
TOC,
BookmarkStart,
BookmarkEnd,
ITitle,
ISubject,
IAuthor,
IOperator,
IKeywords,
IComment,
IVersion,
IDoccomm,
MaxDestination,
AnsiCharSet,
MacCharSet,
PcCharSet,
PcaCharSet,
FFNil,
FFRoman,
FFSwiss,
FFModern,
FFScript,
FFDecor,
FFTech,
Red,
Green,
Blue,
CurHeadPage,
CurFNote,
CurHeadPict,
CurHeadDate,
CurHeadTime,
Formula,
NoBrkSpace,
NoReqHyphen,
NoBrkHyphen,
Page,
Line,
Par,
Sect,
Tab,
Cell,
Row,
CurAnnot,
Annotation,
AnnotID,
CurAnnotRef,
FNoteSep,
FNoteCont,
Column,
OptDest,
IIntVersion,
ICreateTime,
IRevisionTime,
IPrintTime,
IBackupTime,
IEditTime,
IYear,
IMonth,
IDay,
IHour,
IMinute,
INPages,
INWords,
INChars,
IIntID,
BasedOn,
Next,
PaperWidth,
PaperHeight,
LeftMargin,
RightMargin,
TopMargin,
BottomMargin,
FacingPage,
GutterWid,
DefTab,
WidowCtrl,
HyphHotZone,
FNoteEndSect,
FNoteEndDoc,
FNoteText,
FNoteBottom,
FNoteStart,
FNoteRestart,
PageStart,
LineStart,
Landscape,
FracWidth,
NextFile,
Template,
MakeBackup,
RTFDefault,
Revisions,
MirrorMargin,
RevDisplay,
RevBar,
SectDef,
NoBreak,
ColBreak,
PageBreak,
EvenBreak,
OddBreak,
PageStarts,
PageCont,
PageRestart,
PageDecimal,
PageURoman,
PageLRoman,
PageULetter,
PageLLetter,
PageNumLeft,
PageNumTop,
HeaderY,
FooterY,
LineModulus,
LineDist,
LineStarts,
LineRestart,
LineRestartPg,
LineCont,
TopVAlign,
BottomVAlign,
CenterVAlign,
JustVAlign,
Columns,
ColumnSpace,
ColumnLine,
ENoteHere,
TitleSpecial,
CellBordBottom,
CellBordTop,
CellBordLeft,
CellBordRight,
RowDef,
RowLeft,
RowRight,
RowCenter,
RowGapH,
RowHt,
RowLeftEdge,
CellPos,
MergeRngFirst,
MergePrevious,
ParDef,
StyleNum,
QuadLeft,
QuadRight,
QuadJust,
QuadCenter,
FirstIndent,
LeftIndent,
RightIndent,
SpaceBefore,
SpaceAfter,
SpaceBetween,
InTable,
Keep,
KeepNext,
SideBySide,
PBBefore,
NoLineNum,
TabPos,
TabRight,
TabCenter,
TabDecimal,
TabBar,
BorderTop,
BorderBottom,
BorderLeft,
BorderRight,
BorderBox,
BorderBar,
BorderBetween,
BorderSingle,
BorderThick,
BorderShadow,
BorderDouble,
BorderDot,
BorderHair,
BorderSpace,
LeaderDot,
LeaderHyphen,
LeaderUnder,
LeaderThick,
Plain,
Bold,
Italic,
StrikeThru,
Outline,
Shadow,
SmallCaps,
AllCaps,
Invisible,
FontNum,
FontSize,
Expand,
Underline,
WUnderline,
DUnderline,
DbUnderline,
NoUnderline,
SuperScript,
SubScript,
Revised,
ForeColor,
BackColor,
MacQD,
WinMetafile,
WinBitmap,
PicWid,
PicHt,
PicGoalWid,
PicGoalHt,
PicScaleX,
PicScaleY,
PicScaled,
PicCropTop,
PicCropBottom,
PicCropLeft,
PicCropRight,
PixelBits,
BitmapPlanes,
BitmapWid,
PicBinary,
FieldDirty,
FieldEdited,
FieldLocked,
FieldPrivate,
TOCType,
TOCLevel,
PosX,
PosXCenter,
PosXInside,
PosXLeft,
PosXOutSide,
PosXRight,
PosY,
PosYInline,
PosYTop,
PosYCenter,
PosYBottom,
AbsWid,
TextDist,
RPosMargV,
RPosPageV,
RPosMargH,
RPosPageH,
RPosColH
};
typedef void (*Callback)(void*);
void SkipGroup ( void );
/*
* parser is here vvvvvvv when function is called.
* { .... ...}
* skip to here ^ and return
*/
int GetToken ( void );
int CheckCM ( int , int major );
int CheckCMM ( int , int major , int minor );
int CheckMM ( int major , int minor );
int Class()
{ return rtfClass; };
int Major()
{ return rtfMajor; };
int Minor()
{ return rtfMinor; };
int Param()
{ return rtfParam; };
int TokenLength()
{ return rtfTextLen; };
const char* TokenText()
{ return rtfTextBuf; };
protected:
RTF();
virtual int next_char() = 0;
virtual void pushback(int c) = 0;
static int inited;
/*
RTF buffer size (avoids BUFSIZ, which differs across systems)
*/
enum{ BufSiz= 1024};
char rtfTextBuf[BufSiz]; /* text of token */
int rtfTextLen; /* length of token in rtfTextBuf */
int rtfClass; /* token class */
int rtfMajor; /* token major number */
int rtfMinor; /* token minor number */
int rtfParam; /* control symbol parameter */
virtual void _GetToken ( void );
private:
int GetChar ( void );
void Lookup (const char*);
};
#endif